Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eliminate sleep from android emulator doc examples #4277

Merged

Conversation

vaslabs
Copy link
Contributor

@vaslabs vaslabs commented Jan 9, 2025

Summary

This should fix the android job back to green and has some improvements on handling the android emulator in the CI (and locally) , part of which eliminates the need for sleep hack in documentation examples.

Job reference on my fork can be found here . Sometimes the device may be stuck in unauthorized, I don't know the reason yet and can't yet replicate it locally .

Unauthorized issue

In https://github.com/ReactiveCircus/android-emulator-runner, it seems that the same issue occurs when caching is used. I'm wondering if there's any implicit caching that I have missed in the github actions

After experimenting with https://github.com/vaslabs-ltd/test-android-emulator , it seems that the runner avd directory is polluted. Although I'm not sure why, deleting it (at least in test-android-emulator) fixes the unauthorized issue . I've added the same in the github action here

Improvements

  • Removed the need for sleep in doc examples by implementing a new wait for device boot flag, that's used internally by startAndroidEmulator in addition to listening for the booted log message. Having both can help identify potential issues locally or in a CI . Task.Command(exclusive = true) as suggested by @lihaoyi seems to have made it very stable

Fixes

  • Fixed the bundle failing for the manifest/AndroidManifest.xml error message by flattening the zip file. I am not sure when this broke, but bundle is not in my radar in the immediate future, so my focus was to keep it green for now. Bundle build tool also seems to be marked as experimental, not that it's an issue, just a mention.

Note

For the wait, I initially had it in a task and used a while loop but changed my mind and having it outside of task context seems easier to control the behaviour . I can convert it into a tailrec function if you prefer that style

EDIT: changed the outcome of unauthorized after some experimentation on a clean repo

…t misses the manifest/AndroidManifest.xml in a non flat provided zip

Cosmetics
@lihaoyi
Copy link
Member

lihaoyi commented Jan 9, 2025

Looks good to me. There's still a failure in example.android, but happy to merge regardless if you think this is a step forward @vaslabs

@vaslabs
Copy link
Contributor Author

vaslabs commented Jan 9, 2025

Looks good to me. There's still a failure in example.android, but happy to merge regardless if you think this is a step forward @vaslabs

I've managed to replicate the issue here https://github.com/vaslabs-ltd/test-android-emulator , seems consistent, I'll spend some more time on it and ping you when ready

@vaslabs
Copy link
Contributor Author

vaslabs commented Jan 9, 2025

@lihaoyi seems to be ready

@lihaoyi lihaoyi merged commit 7e2cd92 into com-lihaoyi:main Jan 9, 2025
28 checks passed
@lefou lefou added this to the 0.12.6 milestone Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants